package com.feiyu.paymentAndcredit.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.feiyu.paymentAndcredit.dto.PaymentDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.feiyu.paymentAndcredit.entity.DealEntity;
import com.feiyu.paymentAndcredit.service.DealService;
import com.feiyu.common.utils.PageUtils;
import com.feiyu.common.utils.R;


/**
 * @author wanghanbin
 * @email 1336891708@qq.com
 * @date 2021-04-03 12:36:05
 */
@RestController
public class DealController {
    @Autowired
    private DealService dealService;

    /**
     * 列表
     */
    @RequestMapping("/searchTransactionDetails")
    //@RequiresPermissions("product:deal:list")
    public R searchTransactionDetails(@RequestBody Map<String, Object> params) {
        PageUtils page = dealService.queryPage(params);
        if (page.getList().size() > 0) {
            return R.ok("查询成功").put("data", page);
        } else {
            return R.error("查询失败").put("data", null);
        }
    }

    /**
     * 租户或商家账户金额消费
     */
    @PostMapping("/payAmount")
    public boolean payAmount(@RequestBody PaymentDto dto) {
        dealService.changeAccountMoney(dto);
        return true;
    }

}
